package bepviet.android.ui;


import bepviet.android.engine.R;

import android.app.Activity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.LinearLayout;
import android.widget.TextView;

public class Home {
	
	
	public Home(Activity mContext){
		this.context = mContext;
	}
	
	
	private Activity context;
	private TextView clickmonan,clicktheloai,clicknguongoc,clicknguyenlieu;
	private LinearLayout layoutmenu;
	
	
	public View getView(){
		View view = LayoutInflater.from(this.context).inflate(R.layout.choice_menu, null);
		
		
		clickmonan = (TextView)view.findViewById(R.id.txtmonan);
		clicktheloai = (TextView)view.findViewById(R.id.txttheloai);
		clicknguongoc = (TextView)view.findViewById(R.id.txtnguongoc);
		clicknguyenlieu = (TextView)view.findViewById(R.id.txtnguyenlieu);
		layoutmenu = (LinearLayout)view.findViewById(R.id.layoutmenu);
		layoutmenu.removeAllViews();
		
		
		final ListMonAn listmonan = new ListMonAn(context);		
		final ListTheLoai listtheloai = new ListTheLoai(context);
		final ListNguyenLieu listnguyenlieu = new ListNguyenLieu(context);
		final ListXuatXu listxuatxu = new ListXuatXu(context);
		layoutmenu.addView(listmonan.getView());
		
		
 //=======================================================================================  
		// click menu on top
		
		clickmonan.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				layoutmenu.removeAllViews();
				layoutmenu.addView(listmonan.getView());
			}
		});
		
		clicktheloai.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				layoutmenu.removeAllViews();
				layoutmenu.addView(listtheloai.getView());
			}
		});
		
		clicknguongoc.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				layoutmenu.removeAllViews();
				layoutmenu.addView(listxuatxu.getView());
			}
		});
		
		clicknguyenlieu.setOnClickListener(new View.OnClickListener() {			
			@Override
			public void onClick(View v) {
				layoutmenu.removeAllViews();
				layoutmenu.addView(listnguyenlieu.getView());
			}
		});
		
		
		view.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT,LayoutParams.FILL_PARENT)); // set params
		return view;
	}

	
	

}
